The fuel consumption or efficiency of an aircraft depends upon several factors that are related to the altitude at which it is flown. One factor is the density of the air, which varies with both the altitude and temperature of the air. Each large aircraft has an optimum weight-to-air density ratio, often referred to as the W/d ratio, at which there is minimal fuel consumption per ground-track mile. An aircraft may initially climb to a permissible altitude such as 35,000 feet, at which the expected air density will result in a W/d ratio close to optimum. When the aircraft looses sufficient fuel and weight, that another permissible altitude will produce a W/d ratio closer to optimum, the aircraft then increases altitude to the next permissible level. (Of course, other factors such as wind speed are also taken into account in determining at what altitude the aircraft will fly).
The actual density of air at any given altitude depends considerably upon the temperature of the air. If the actual air temperature at other altitudes were known, such as at the next higher permissible altitude of an aircraft, then it would be possible to change the aircraft altitude to always fly the aircraft at a permissible altitude which provides a W/d ratio closest to optimum.